﻿using System;
using System.Configuration;

namespace ElectronicCommerce.Framework.Caching.Configuration
{
    /// <summary>
    /// Provider Setting
    /// </summary>
    public class ProviderSetting : ConfigurationElement
    {
        [ConfigurationProperty("name", IsRequired = true)]
        public string Name
        {
            get
            {
                return this["name"].ToString();
            }
            set
            {
                this["name"] = value;
            }
        }

        [ConfigurationProperty("type", IsRequired = true)]
        public string Type
        {
            get
            {
                return this["type"].ToString();
            }
            set
            {
                this["type"] = value;
            }
        }

        [ConfigurationProperty("defaultExpireSeconds", IsRequired = true)]
        public int DefaultExpireSeconds
        {
            get
            {
                return Convert.ToInt32(this["defaultExpireSeconds"]);
            }
            set
            {
                this["defaultExpireSeconds"] = value;
            }
        }

        [ConfigurationProperty("keyPreFix", IsRequired = true)]
        public string keyPreFix
        {
            get { return this["keyPreFix"].ToString(); }
            set
            {
                this["keyPreFix"] = value;
            }
        }

        [ConfigurationProperty("maximumElementsInCache", IsRequired = true)]
        public int MaximumElementsInCache
        {
            get
            {
                return Convert.ToInt32(this["maximumElementsInCache"]);
            }
            set { this["maximumElementsInCache"] = value; }
        }

        [ConfigurationProperty("numberToRemoveWhenScavenging", IsRequired = true)]
        public int NumberToRemoveWhenScavenging
        {
            get
            {
                return Convert.ToInt32(this["numberToRemoveWhenScavenging"]);
            }
            set
            {
                this["numberToRemoveWhenScavenging"] = value;
            }
        }
    }
}
